﻿
#region Copyright & License
// --------------------------
// Copyright 2008 Daniel Gray
// --------------------------
// This file is part of Kale.
//
// Kale is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Kale is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with Kale.  If not, see <http://www.gnu.org/licenses/>.
#endregion
#region File details
// --------------------------------------------------------
// Filename          : SessionProviderElement.cs
// Author            : Daniel Gray
// Created           : 05/05/2008
// --------------------------------------------------------
#endregion
            
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace Kale.Core.Configuration
{
   public class SessionProviderElement : TypeSpecificationElement
   {
      [ConfigurationProperty(AnonymousUsernameConfigurationName, IsRequired = false, DefaultValue = "Anonymous")]
      public string AnonymousUsername
      {
         get { return (string)this[AnonymousUsernameConfigurationName]; }
         set { this[AnonymousUsernameConfigurationName] = value; }
      }

      /// <summary>
      /// Gets or sets the type of the expiration.
      /// </summary>
      /// <value>The type of the expiration.</value>
      [ConfigurationProperty(ExpirationTypeConfigurationName, IsRequired = false, DefaultValue = CacheExpirationType.Sliding)]
      public CacheExpirationType ExpirationType
      {
         get { return (CacheExpirationType)this[ExpirationTypeConfigurationName]; }
         set { this[ExpirationTypeConfigurationName] = value; }
      }

      /// <summary>
      /// Gets or sets the expiration minutes.
      /// </summary>
      /// <value>The expiration minutes.</value>
      [ConfigurationProperty(ExpirationMinutesConfigurationName, IsRequired = false, DefaultValue = 30)]
      public int ExpirationMinutes
      {
         get { return (int)this[ExpirationMinutesConfigurationName]; }
         set { this[ExpirationMinutesConfigurationName] = value; }
      }

      public const string AnonymousUsernameConfigurationName = "anonymousUsername";
      public const string ExpirationTypeConfigurationName = "expirationType";
      public const string ExpirationMinutesConfigurationName = "expirationMinutes";
   }
}
